var express = require('express');
var app = express();
const { port } = require('./page/model/config.js') // 获取启动参数
const {lunbo} = require('./page/lunbo.js')
const {indexlist} = require('./page/Indexlist.js')
const {detail} = require('./page/detail.js')
const {play} = require('./page/play.js')
const {movie} = require('./page/movie.js')
const {tv} = require('./page/tv.js')
const {varitey} = require('./page/varitey.js')
const {anime} = require('./page/anime.js')
const {select} = require('./page/select.js')
const {pagination} = require('./page/pagination.js')
const {hotlist} = require('./page/hotlist.js')
const {search} = require('./page/search.js')
const {message} = require('./page/model/message.js')
const {getmessage} = require('./page/model/getmessage.js')

app.all('*', function (req, res, next) {
    res.header('Access-Control-Allow-Origin', '*');
    res.header('Access-Control-Allow-Headers', 'Content-Type');
    res.header('Access-Control-Allow-Methods', '*');
    res.header('Content-Type', 'application/json;charset=utf-8');
    next();
});

app.get('/lunbo',lunbo);
app.get('/indexlist',indexlist);
app.get('/message',message);
app.get('/getmessage',getmessage);
app.get(`/detail/:id`,detail);
app.get(`/play/:id`,play);
app.get(`/movie`,movie);
app.get(`/hotlist`,hotlist);
app.get(`/tv`,tv);
app.get(`/varitey`,varitey);
app.get(`/search`,search);
app.get(`/anime`,anime);
app.get(`/:id`,select);
app.get(`/?`,pagination);
app.get(`/`,pagination);


app.listen(port, function () {
    console.log('app is listenling at port 4000');
});